//
//  AccessTokenModel.swift
//
//  Created by mba on 16/8/19
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

open class AccessTokenModel: BaseModel{
    
	internal let kAccessTokenModelLoginTokenKey: String = "login_token"
	internal let kAccessTokenModelAccessTokenKey: String = "access_token"
	internal let kAccessTokenModelUidKey: String = "uid"
    internal let kAccessTokenModelNicknameKey: String = "user_name"
    internal let kAccessTokenModelAvatarKey: String = "avatar"

    // MARK: Properties
	open var loginToken: String?
	open var accessToken: String?
	open var uid: String?
    open var nickname: String?
    open var avatar: String?
    var register: Int = 0

    
    public required init?(map: Map) {
       super.init(map: map)
    }

    open override func mapping(map: Map) {
        super.mapping(map: map)
		loginToken <- map[kAccessTokenModelLoginTokenKey]
		accessToken <- map[kAccessTokenModelAccessTokenKey]
		uid <- map[kAccessTokenModelUidKey]
        nickname <- map[kAccessTokenModelNicknameKey]
        avatar <- map[kAccessTokenModelAvatarKey]
        register    <- map["register"]
    }


    open func dictionaryRepresentation() -> [String : AnyObject ] {

        var dictionary: [String : AnyObject ] = [ : ]
		if loginToken != nil {
			dictionary.updateValue(loginToken! as AnyObject, forKey: kAccessTokenModelLoginTokenKey)
		}
		if accessToken != nil {
			dictionary.updateValue(accessToken! as AnyObject, forKey: kAccessTokenModelAccessTokenKey)
		}
		if uid != nil {
			dictionary.updateValue(uid! as AnyObject, forKey: kAccessTokenModelUidKey)
		}
        if nickname != nil {
            dictionary.updateValue(nickname! as AnyObject, forKey: kAccessTokenModelNicknameKey)
        }
        if avatar != nil {
            dictionary.updateValue(avatar! as AnyObject, forKey: kAccessTokenModelAvatarKey)
        }

        return dictionary
    }

}
